<?php

class  Somi_Models_Auftrag extends Zend_Db_Table_Abstract 
{
	protected $_name='auftrag';
	protected $_primary = 'auftrag_id';
	#protected $_rowClass = 'user';
	protected $_sequence  = true;
	
	#protected $_dependentTables = array('email');
	
	
    public function getAuftrag($id){	
    	$auftrag=$this->fetchRow('auftrag_id="'.$id.'"'); 	
    	return $auftrag;
    }
    
    public function update($daten,$id){
    	$db= Zend_Registry::get('db');
    	$db->beginTransaction();
    	try{
    	$db->update('auftrag',$daten,'auftrag_id='.$id);
    	$db->commit();
    	}catch(Exception $e){
    		$db->rollBack();
    	}   	
    }
	
	public function insert($daten){
    	$db= Zend_Registry::get('db');
    	$db->beginTransaction();
    	try{
    	$db->insert('auftrag',$daten);
    	$db->commit();
    	}catch(Exception $e){
    		$db->rollBack();
    	}    	
    }
    
	public function delete($id){
    	$db= Zend_Registry::get('db');
    	$db->beginTransaction();
    	try{
    	$db->delete('auftrag','auftrag_id="'.$id.'"');
    	$db->commit();
    	}catch(Exception $e){
    		$db->rollBack();
    	}    	
    }
    
	public function getStatus(){
    	$db= Zend_Registry::get('db');
		$temp = $db->describeTable('auftrag'); 
		$temp_enum=$temp['status']['DATA_TYPE'];
		$temp=explode("','",preg_replace("/(enum|set)\('(.+?)'\)/","\\2",$temp_enum));		
    	return $temp;  	
    }
    
	public function getSupportart(){
    	$db= Zend_Registry::get('db');
		$temp = $db->describeTable('auftrag'); 
		$temp_enum=$temp['supportart']['DATA_TYPE'];
		$temp=explode("','",preg_replace("/(enum|set)\('(.+?)'\)/","\\2",$temp_enum));		
    	return $temp;  	
    }
    
    
}

?>